<template>
    <div class="Log">
        <el-table border :data="logData.slice((currentPage-1)*pageSize,currentPage*pageSize)">
            <el-table-column type="expand">
                <template slot-scope="props">
                    <el-form label-position="left" inline class="table-expand">
                        <el-form-item  v-for="(item,indexMark) in props.row.data" :key="indexMark">
                            <label>{{indexMark}}</label>
                            <span>{{ item}}</span>
                        </el-form-item>
                    </el-form>
                </template>
            </el-table-column>
            <el-table-column
                    type="index"
                    label="id">
            </el-table-column>
            <el-table-column
                    prop="DateTime"
                    label="DateTime">
            </el-table-column>

            <el-table-column
                    prop="StrategyID"
                    label="StrategyID">
            </el-table-column>
            <!--<el-table-column-->
                    <!--prop="BackTestID"-->
                    <!--label="BackTestID">-->
            <!--</el-table-column>-->
            <el-table-column
                    prop="ExchangeID"
                    label="ExchangeID">
            </el-table-column>
            <el-table-column
                    prop="Symbol"
                    label="Symbol">
            </el-table-column>
            <el-table-column
                    prop="DataType"
                    label="DataType">
            </el-table-column>
            <el-table-column
                    prop="CallingClass"
                    label="CallingClass">
            </el-table-column>
            <el-table-column
                    prop="CallingMethod"
                    label="CallingMethod">
            </el-table-column>


        </el-table>
        <el-pagination
                :page-size="pageSize"
                @current-change="handleCurrentChange"
                layout="prev, pager, next"
                :total=pageTotal>
        </el-pagination>

    </div>
</template>

<script>
    export default {
        name: "Log",
        data(){
            return {
                logData:[],
                pageSize:10,
                pageTotal:0,
                currentPage:1
            };
        },
        mounted(){
            this.getAllLog();
        },
        methods:{
            getAllLog(){
                this.axios
                    .get(this.STRATEGY_LOG_NEW)
                    .then(res => {
                        if (res.data.status == 'success') {
                            this.logData=res.data.data;
                            this.pageTotal = this.logData.length;
                        }else {
                            this.$message({message: res.data.msg});
                        }
                    })
                    .catch(res => {

                    });
            },
            handleCurrentChange(val){
                this.currentPage = val;
            }
        }
    }
</script>

<style scoped>
.Log .el-form--inline .el-form-item{
    width: 30%;margin-bottom: 0px;
}
.Log .el-form-item__content label{
    color: #99a9bf !important; padding-right: 20px;
}
</style>
